<!--
/*
#################################################################################
#
# Copyright (c) 2006 Michigan State University
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#################################################################################

#################################################################################
#
#	Author:
#		Nathan Collins <npcollins@gmail.com>
#
#################################################################################
*/

function addUser() {
	login = document.getElementById('adduser').addName.value;
	pw = hex_md5(document.getElementById('adduser').addPw.value);
	/* check input */
	if (login.length < 1) {
		alert('Please enter a login name.');
	}
	else {
		url = '/editor.py?a=admin&ael='+login+'&aep='+pw;
		window.location = url;
	}
	return false;
}

function confirmDeleteAcct(acct) {
	confirmed = confirm('Delete the account ' + acct + '?');
	if (confirmed) {
		return true;
	}
	return false;
}

function changeName(name) {
	modn = document.getElementById('clg'+name).modn.value;
	url = '/editor.py?a=admin&acct=' + name + '&modn=' + modn;
	window.location = url; 
	return false;
}

function changePw(name) {
	pw = document.getElementById('cpw'+name).modp.value;
	hexpw = hex_md5(pw);
	url = '/editor.py?a=admin&acct=' + name + '&modp=' + hexpw;
	window.location = url; 
	return false;
}

function userChangePw() {
	pwcf = document.getElementById('pwchg')
	pw1 = pwcf.pwd.value;
	pw2 = pwcf.pwdc.value;
	if (pw1 == pw2) {
		npw = hex_md5(pw1);
		url = "/editor.py?a=pwchg&npw="+npw;
		window.location = url;
	}
	else {
		alert('Passwords do not match. Please try again.');
	}
	return false;
}

function confirmDelete(id) {
	a = confirm('Are you sure you want to delete the current entry from the directory?\n\nReject this suggestion if you only want to delete the suggestion.');
	if (a == true) {
		sendAR(id,'d');
	}
}

function editSuggestion(id) {
	window.location = '/suggest.py?edit=' + id;
}

function rejectOption(id) {
	rej = confirm('Do you wish to reject the submission?');
	if (rej == true) {
		sendAR(id,'r');
	}
}

//-->
